home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / utilities / easyproc2.lha / EasyProcess / launch / CheckAlive.c next >
Encoding:
C/C++ Source or Header  |  1992-11-05  |  937 b   |  52 lines

  1. #include "Launch.h"
  2. #include "LaunchPriv.h"
  3.  
  4.  
  5. /*
  6.  *    NAME
  7.  *        CheckAlive -- check if the process is still alive.
  8.  *
  9.  *    SYNOPSIS
  10.  *        alive = CheckAlive (Proc)
  11.  *
  12.  *        BOOL CheckAlive (struct Process *);
  13.  *
  14.  *    DESCRIPTION
  15.  *        Scan the list of process pair for a pair whose child is the
  16.  *        process passed as input.  It then check if the entry point is
  17.  *        NULL, meaning the child is dead.
  18.  *
  19.  *    INPUT
  20.  *        Proc - the process who wants to find if it's alive.
  21.  *
  22.  *    OUTPUT
  23.  *        alive - non-null if the process is alive.
  24.  *
  25.  *    NOTE
  26.  *        This function can be used as a polling mecanism to find out
  27.  *        if the child still exists.
  28.  *
  29.  *    HISTORY
  30.  *        1992/09/06    Pierre Baillargeon        Creation
  31.  *
  32.  */
  33.  
  34. BOOL CheckAlive (struct Process *Proc)
  35. {
  36.     struct ProcPair *pp;
  37.     BOOL result;
  38.  
  39.     Forbid ();
  40.     if (NULL != ProcPairList && NULL != (pp = IsChild (Proc)))
  41.     {
  42.         result = (pp->pp_ChildEntry != NULL);
  43.     }
  44.     else
  45.     {
  46.         result = 0;
  47.     }
  48.     Permit ();
  49.  
  50.     return result;
  51. }
  52.